import type { Metadata } from "next";
import style from "./index.module.scss";
import JobTitle from "./components/JobTitle";
import Header from "@/app/components/Header";
import Footer from "@/app/components/Footer";
import { getCvTempList, getStations, getTemplatesByClassify } from "@/service";
import Pager from "@/app/components/Pager";
import RightContent from "@/app/components/RightContent";
import List from "./_list";

export const metadata: Metadata = {};
const titleMap = {
  list: "简历模板_简历制作_免费在线简历制作_百捷简历",
  jianjie: "简洁风格在线简历模板_免费简历制作_百捷简历",
  shuanglan: "双栏风格在线简历模板_免费简历在线制作_百捷简历",
  table: "简历表格在线制作_免费个人简历表格模板_百捷简历",
  yingjiesheng: "应届生简历模板_求职简历模板_百捷简历",
  jingmei: "精美风格简历模板_精美在线简历制作_百捷简历",
  remen: "热门简历模板_求职简历模板_百捷简历",
};
export default async function Home({ params }) {
  const { type, page } = params;
  const res = await getStations();
  let list = [];
  if (res.code === 200) {
    list = res.data.list;
  }
  let tempList = [];

  const temps = await getCvTempList({
    pageNum: page || 1,
    pageSize: 10,
  });
  if (temps.code === 200) {
    tempList = temps.data?.list || [];
  }
  return (
    <>
      <Header current="muban" style={{ background: "#fff" }} />
      <main className={style.main}>
        <JobTitle list={list} type={type}></JobTitle>
        <div className={style.container}>
          <div className={style.left}>
            <List list={tempList} />
            <div style={{ overflow: "hidden" }}>
              <Pager
                style={{ float: "right" }}
                listLen={10 || 0}
                total={temps?.data?.total || 0}
                baseUrl={"cv/" + type}
                page={+page}
              ></Pager>
            </div>
          </div>
          <div className={style.right}>
            <RightContent fromList={true} />
          </div>
        </div>
        <Footer />
      </main>
    </>
  );
}
